package com.empty.oredermenu.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.amap.api.maps.model.LatLng;
import com.amap.api.maps.model.Poi;
import com.amap.api.navi.AmapNaviPage;
import com.amap.api.navi.AmapNaviParams;
import com.amap.api.navi.INaviInfoCallback;
import com.amap.api.navi.model.AMapNaviLocation;
import com.empty.oredermenu.R;
import com.empty.oredermenu.utils.TTSController;

/**
 * Created by empty cup on 2017/8/22.
 */

public class AMmapActivtiy extends Activity implements INaviInfoCallback {

    TTSController amapTTSController;//语音 开始

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_find);
        TextView textfind = (TextView) findViewById(R.id.textfind);

        amapTTSController = TTSController.getInstance(getApplicationContext());
        amapTTSController.init();

        textfind.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                LatLng epoint = new LatLng(31.513189, 104.703435);
                Poi epoi = new Poi("绵阳", epoint, "成都");
                AmapNaviPage.getInstance().showRouteActivity(getApplicationContext(), new AmapNaviParams(epoi), AMmapActivtiy.this);
            }
        });
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        amapTTSController.destroy();
    }

    @Override
    public void onInitNaviFailure() {

    }

    @Override
    public void onGetNavigationText(String s) {
        amapTTSController.onGetNavigationText(0,s);
    }

    @Override
    public void onLocationChange(AMapNaviLocation aMapNaviLocation) {

    }

    @Override
    public void onArriveDestination(boolean b) {

    }

    @Override
    public void onStartNavi(int i) {

    }

    @Override
    public void onCalculateRouteSuccess(int[] ints) {

    }

    @Override
    public void onCalculateRouteFailure(int i) {

    }

    @Override
    public void onStopSpeaking() {
        amapTTSController.stopSpeaking();
    }
}
